package com.jinhongone.pattern.creater.factory.config_simpleFactory;

public class AmericanCoffee extends Coffee {
    //1.私有构造函数
    private AmericanCoffee(){
        //单例防反射逻辑
//        if(instance != null){
//            throw new RuntimeException("请通过正确方式获取对象");
//        }
    }
    //2.使用饿汉模式单例模式
    public static AmericanCoffee instance = new AmericanCoffee();

    @Override
    public String getName() {
        return "美式coffee";
    }
}
